package models;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Id;

import com.googlecode.objectify.annotation.Cached;
import com.googlecode.objectify.annotation.Indexed;
import com.googlecode.objectify.annotation.Unindexed;

@Cached
public class UserModel implements Serializable {
	@Id private String username = "";
	
	@Unindexed private String fullname = "";
	
	@Indexed private int status = 0; //0-Inactive, 1-Pending, 2-Active
	
	@Unindexed private Date created = new Date();
	
	@Unindexed private int gender = 0; //0-male, 1-female

	@Unindexed private int role = 0; //0-user, 1-administrator

	@Unindexed private String sessionToken;
	
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getFullname() {
		return fullname;
	}

	public void setFullname(String fullname) {
		this.fullname = fullname;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public int getGender() {
		return gender;
	}

	public void setGender(int gender) {
		this.gender = gender;
	}

	public int getRole() {
		return role;
	}

	public void setRole(int role) {
		this.role = role;
	}

	public String getSessionToken() {
		return sessionToken;
	}

	public void setSessionToken(String sessionToken) {
		this.sessionToken = sessionToken;
	}
	
	/**
	  * Whether the token is set.
	  * @return if the token was set.
	  */
	public Boolean hasSessionToken() {
		return (sessionToken == null) ? false : true; 
	}
}
